package com.yx.china.project.api;

import com.yx.china.project.entities.Payment;
import com.yx.china.project.entities.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
@Slf4j
public class OrderApi {

    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/order/payment/getConsul/{id}")
    public ResponseResult<Payment> getPayment(@PathVariable("id") Long id){
        return restTemplate.getForObject("http://pay-service/payment/getConsul/"+id,ResponseResult.class);
    }
}
